package net.caixiaomi.info.util;

import android.os.Environment;

import java.io.File;


/**
 * Created by liubo on 2018/3/26.
 */

public class MyUtil {

    public static void deleteDir(File dir) {
        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
            if (dir != null && dir.exists()) {
                if (dir.isDirectory()) {
                    File [] children =dir.listFiles();
                    for(File file:children){
                        deleteDir(file);
                    }
                } else if(!dir.isDirectory()&&dir.exists()){
                    dir.delete();
                }
            }
        }
    }

}
